╘HIS IS A WELL KNOWN GAME. ╔T GOES UNDER VARIOUS NAMES, ┬AGELS, ═ASTERMIND AND SO ON.
╘HERE ARE TWO GOOD VERSIONS, BOTH BY ╩IM ┬UTTERFIELD. ╧NE LETS ┘╧╒ SOLVE THE PUZZLE. ╘HE OTHER IS CAPABLE OF PLAYING. ╘HE FOLLOWING IS ╩IM'S LATEST VERSION- YOU SOLVE THE PUZZLE, THE COMPUTER KEEPS THE SCORE. ╘HE PROGRAM IS IN THE PUBLIC DOMAIN. ╔T WAS DESCRIBED WITH FULL DETAILS IN THE SUMMER '83 ISSUE OF ├OMMODORE'S ╨╧╫┼╥/╨╠┴┘ MAGAZINE.
┴T THE TIME ╩IM WROTE THIS PROGRAM, HE WAS DEMONSTRATING ┬╧╧╠┼┴╬ FUNCTIONS IN THE COMPUTER. ╫ORDS SUCH AS ╧╥, ┴╬─, ╬╧╘ ARE ┬OOLEAN FUNCTIONS. ╘ESTS SUCH AS "╔╞ ╪ ╘╚┼╬ DO SOMETHING" FITS IN THE ┬OOLEAN DEPARTMANT. ╙TATEMENTS SUCH AS ┴=┬+├<>7 (SUBTRACTS! 1 IF ├<>7) ARE ALL RELATED.
╔N ANY CASE, IF YOU TYPE THIS GAME IN, YOU'LL HAVE A GOOD GAME IN YOUR REPERTOIRE. ┴ND IF YOU FOLLOW THE CODING CAREFULLY, YOU WILL LEARN NEW THINGS.
// PRG: BOOLEAN BAGELS //
Ç*FP10
*** ╓┴╥╔┴┬╠┼╙ ***
├() COMBINATION TO GUESS
╪() YOUR GUESSES
═() EXACT MATCHES
═ THEIR COUNT
╬() OUT-OF-PLACE MATCHES
╬ THEIR COUNT
╟ COUNTS GUESSES
┬ FLAGS ANY MATCHES
REUSED TO FLAG 4 EXACT MATCHES
*** ╔╬╙╘╥╒├╘╔╧╬╙ ***
╥╒╬ THE PROGRAM. ╘HE SCREEN WILL TELL YOU WHAT TO DO. ┴ TYPICAL DIALOGUE MAY LOOK LIKE THIS:
// PIC: BAGELS //
*** ─┼╘┴╔╠╙ ***
╬OTE HOW ╩IM USES THE ┴╙├ AND ├╚╥$ FUNCTIONS TO GET USER RESPONSES. ╬OTE THE USE OF ARRAYS TO HOLD THE POSITIONS. ┼XACT MATCHES ARE COUNTED IN LINES 310-340. ┬OTH THE ═ AND ╬ ARRAYS GET FILLED, SINCE WE MUST NOT COUNT ANY MATCHES TWICE.
┘OU CAN ╙╘╧╨ THE PROGRAM AT ANY TIME AND PRINT VARIABLES THAT INTEREST YOU. ┴RE THEY WHAT YOU THOUGHT THEY WOULD BE? ╫HY, OR WHY NOT?
╠INES 350-410 TAKE CARE OF NON-EXACT MATCHES WITHOUT ANY DOUBLE COUNTING. ╘HIS REQUIRES TWO NESTED LOOPS TO SCAN ALL POSITIONS, BUT, AGAIN, ONLY THOSE COMBINATIONS THAT ARE NOT KNOWN TO HAVE BEEN MATCHED YET ARE LOOKED AT.
╠INE 420 TESTS IF WE HAVE FINISHED, IF NOT, AND NUMBER OF GUESSES IS TEN OR UNDER WE LOOP BACK TO LINE 240 FOR NEXT GUESS. ╧THERWISE THE ORIGINAL COMBINATIONS PRINTS, AND YOU'RE INVITED TO TRY AGAIN. ╟OOD GAME.
*** ╨╠┴┘ ┴╟┴╔╬╙╘ ╘╚┼ ├╧═╨╒╘┼╥ ***
╘HE OTHER VERSION OF THE GAME IS PLAYED BETWEEN YOU AND THE COMPUTER. ╔T IS LONGER THAN THIS SIMPLE VERSION, SO IF YOU ARE INTERESTED IN HAVING A COPY YOU DON'T HAVE TO TYPE IN, ONE CAN BE OBTAINED FROM ╘╨╒╟. ╘╨╒╟ IS LISTED IN THE REFERENCES. ╔T IS WORTH HAVING. ╔T PLAYS A VERY GOOD GAME, DOESN'T CHEAT, DOESN'T LET YOU CHEAT AND IS GENERALLY QUITE CHALLENGING.